#For any entry in TESTS named XYZ, there should exist a XYZ.enum file,
#and an XYZ_tut.cpp test for it.

TESTS=	Foo \
	Basic1 \
	Side \

TUT_TESTS_BASE=$(addsuffix _tut, $(TESTS))
TUT_CPP=$(addsuffix .cpp, $(TUT_TESTS_BASE))
TUT_OBJ=$(addsuffix .o, $(TUT_TESTS_BASE))

ENUM_FILES=$(addsuffix .enum, $(TESTS))

#todo associate prefix/suffic with files, then build this list by
#appending/prepending to the appropriate tests.  But this is good
#enough for now.
GEN_ENUM_BASE=$(TESTS)
GEN_ENUM_HPP=$(addsuffix _Enum.hpp, $(GEN_ENUM_BASE))
GEN_ENUM_IPP=$(addsuffix _Enum.ipp, $(GEN_ENUM_BASE))
GEN_ENUM_CPP=$(addsuffix _Enum.cpp, $(GEN_ENUM_BASE))
GEN_ENUM_OBJ=$(addsuffix _Enum.o, $(GEN_ENUM_BASE))

CC=g++
CPPFLAGS+=-g

all: test_runner

test_runner: $(GEN_ENUM_HPP) $(GEN_ENUM_OBJ) $(TUT_OBJ)
	$(CC) $(CPPFLAGS) -I. test_runner.cpp $(GEN_ENUM_OBJ) $(TUT_OBJ) -o test_runner

%.o%.cpp:
	$(CC) $(CPPFLAGS) -c $< -o %@

$(GEN_ENUM_CPP): $(GEN_ENUM_HPP)

%_Enum.hpp: %.enum ../enumgen.lisp ../enumgen.def
	../enumgen $<


.PHONY: clean
clean: 
	rm -f *.o *~ test_runner

.PHONY: realclean
realclean: clean
	rm -f $(GEN_ENUM_HPP) $(GEN_ENUM_IPP) $(GEN_ENUM_CPP)
